package com.wyl

import com.wyl.dao.UserDao
import com.wyl.dao.UserDaoOracleImpl
import com.wyl.service.UserService
import com.wyl.service.UserServiceImpl
import org.junit.Test
import org.springframework.context.ApplicationContext
import org.springframework.context.support.ClassPathXmlApplicationContext

class MyTest {
    @Test
    fun test() {
        val userDao: UserDao = UserDaoOracleImpl()
        val userService: UserService = UserServiceImpl(userDao)
        userService.getUser()
    }

    @Test
    fun test2() {
        val context: ApplicationContext = ClassPathXmlApplicationContext("beans.xml")
        val userService: UserService = context.getBean("userServiceImpl") as UserService
        userService.getUser()
    }
}